package com.designed.pattern.creational.singleton.staticInnerclass;

/**
 * @author yifei
 * @date 2024/3/28
 **/
public class StaticInnerClassSingleton {
    private StaticInnerClassSingleton() {
    }

    public static StaticInnerClassSingleton getInstance() {
        return InnerClass.singleton;
    }

    static class InnerClass {
        private static StaticInnerClassSingleton singleton = new StaticInnerClassSingleton();
    }

    private Object readResolve(){
        return InnerClass.singleton;
    }
}
